define(
		[ 'jquery', 'platform.common', 'formview', 'methods', 'bs.table',
				'bootbox', 'bs.table-CN' ],
		function($, platform, formview, methods) {
			return {
				$table : $('#attachmentTb'),
				loadGrid : function() {
					var columns = [ {
						checkbox : true,
						field : 'checkbox',
					}, {
						field : 'attachment_id',
						title : '附件主键标识',
						visible : false
					}, {
						field : 'attachment_name',
						title : '附件名'
					}, {
						field : 'attachment_type',
						title : '类型'
					}, {
						field : 'upload_time',
						title : '上传时间'
					}, {
						field : 'effective_status',
						title : '生效状态',
						visible : false
					}, {
						field : 'remarks',
						title : '备注',
						visible : false
					} ];
					this.$table.bootstrapTable({
						url : platform.mapUrl('~/rest/attachment/list'),
						cache : false,
						method : 'post',
						singleSelect : true,
						striped : true,
						showRefresh : true,
						silent : true,
						pagination : true,
						sidePagination : 'server',
						pageNumber : 1,
						pageSize : 10,
						pageList : [ 10, 15, 20, 50 ],
						queryParams : function(params) {
							return {
								pageNumber : params.offset / params.limit + 1,
								pageSize : params.limit
							}
						},
						clickToSelect : true,
						uniqueId : 'code_id',
						toolbar : '#toolbar',
						height : 504,
						columns : columns
					});
				},
				refresh : function() {
					this.$table.bootstrapTable('refresh');
				},
				fnAdd : function() {
					formview.showNewForm();
				},
				fnRemove : function() {
					var that = this;
					var selections = this.$table
							.bootstrapTable('getSelections');
					if (selections == null
							|| selections == undefined
							|| (selections instanceof Array && selections.length != 1)) {
						platform.showtip('remove');
						return;
					}
					var bootbox = require('bootbox');
					platform.confirm(bootbox,
							'<i class="fa fa-warning"></i>&nbsp;&nbsp;删除提示信息',
							'small', '确认是否删除?', '确认', '取消', function() {
								var id = selections[0].attachment_id;
								var param = {};
								param.attachment_id = id;
								platform.servicebreakAsync(
										'~/rest/attachment/delete', param,
										'post', function() {
											platform.showOperTip('DEALING');
										}).done(function(response) {
									if (response.success) {
										platform.showOperTip('DELSUC');
										that.refresh();

									} else {
										platform.showErrorTip(response.msg);

                                    }
								});
							});
				},
				fnSearch : function() {

				}
			};
        });
/**
 * 
 */
